python

您所在的位置:网站首页 mysql 启动失败 报ssl不可用 python

python

2024-02-18 17:54| 来源: 网络整理| 查看: 265

我正在我运行 centos 6.10 的专用服务器上安装 Python 3.7 在经历了一些尝试之后,我遇到了另一个错误。使用 Python 3.7 尝试保持最新状态,pip 安装出现 SSL 问题是一个相当普遍的问题。我得出的结论是,解决此问题的最佳方法是获取正确版本的 OpenSSL。所以我这样做了,并编辑了我的 python modules/Setup.dist 文件,重新配置它,重新运行 make altinstall,虽然一切看起来都很好。出于某种原因,命令 Python3.7 这是我之前用来运行这个python的命令,突然变得无法识别为命令,而在Python3.7目录中是一个文件夹 python 现在执行时(编辑环境路径后打开 Python3.7。之前情况并非如此,它只是 Python3.7 有人知道这里会发生什么吗?

此外,我对整个 SSL 的事情都感到无能为力,而且我已经阅读了关于阳光下的每篇文章的感觉。这是我最近执行的一些命令的列表:

#Unpacked Python3.7 into /usr/src directory ./configure --enable-optimizations --enable-loadable-sqlite-extensions make altinstall #installation failed from no '_ctypes' module yum install libffi-devel #repeat configure above #yaaay python #Successfully installed pip-10.0.1 setuptools-39.0.1 was the final message of the installation Python3.7 -m venv /my/project/directory/ENV pip install {library} #this is where my issues began with SSL

日志:

(ENV) [[email protected] ProjectDirectory]# pip3 install twisted pip is configured with locations that require TLS/SSL, however, the SSL module in Python is not available. Collecting twisted Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/twisted/ Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/twisted/ Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/twisted/ Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/twisted/ Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/twisted/ Could not fetch URL https://pypi.org/simple/twisted/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/twisted/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping Could not find a version that satisfies the requirement twisted (from versions: ) No matching distribution found for twisted pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSLmodule is not available.")) - skipping

所以我觉得还不错。不用担心。最新版本的 Python 甚至无法立即获得 pip3。精彩的。好吧,我开始像我们一样搜索谷歌并得出结论,每个人都只是再次重新配置他们的 python 并且它神奇地起作用了。不知道为什么,但是没关系。我很喜欢它。我找到了这篇文章:

https://techglimpse.com/install-python-openssl-support-tutorial/

想想好酷。如果我可以获得 python3.7 SSL,那么它应该可以让 pip3 正常工作吗?错误的。不幸的是,如果我以上面提到的新的奇怪方式启动 Python3.7,并键入 import ssl 我会收到此错误:

Traceback (most recent call last): File "", line 1, in File "/usr/src/Python-3.7.0/Lib/ssl.py", line 98, in import _ssl # if we can't import it, let the error propagate ModuleNotFoundError: No module named '_ssl'

谁能给我一些帮助?我有点迷失在海洋中,而且我不会游泳……任何东西都会很棒,但我是这个服务器管理员的菜鸟所以越简单越好 :) 谢谢你进步。

编辑:顺便说一下

yum install openssl

yum install openssl-devel

两者都会导致“已安装”标志……所以我认为这不是另一种解决方案。但是,当我手动安装时,我使用了 1.1.1 版,因为我知道 3.7 出于某种原因放弃了对几个不同版本的 OpenSSL 的支持。我认为已经安装了 yum 的是 1.0.2。我不知道是否有 centos 6.10 平台的容量,尽管就版本限制而言。

原文由 Pixelknight1398 发布,翻译遵循 CC BY-SA 4.0 许可协议



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3